Creation parameters:
The
parent is important, as this is the only way to receive wxTimer events.
The
id is also important, especially if you plan to have more than one wxTimer,
because timer events can only be distinguished by their id.
To set a timer event handler, use wxEVT_TIMER:
code
ex:
constant
main = create( wxFrame, {0,-1,"Timer"}),
timer_id = new_id(),
timer = create( wxTimer, {main, timer_id})
procedure on_timer( atom this, atom event_type, atom id, atom event )
puts(1,"Timer\n")
end procedure
-- NOTE: using the parent and the id to identify the timer.
set_event_handler( main, timer_id, wxEVT_TIMER, routine_id("on_timer"))
-- set the timer to fire every 1 second, repeatedly
start_timer( timer, 1000, 0 )
wxMain( main )
endcode
proc start_timer( atom timer, atom msec, integer oneshot )
proc stop_timer( atom timer )
Parent Topics:
Classes
Events
Timers
[proc]
start_timer ( atom timer, atom msec, integer oneshot )
Category: wxTimer
Set the timer to fire every msec millisecond ( 1000msec = 1sec ). oneshot
indicates whether the timer should stop firing after the first time, or fire
repeatedly until stop_timer() is called.
See Also:
stop_timer
Category: wxTimer
Stops a timer from firing until reset using start_timer().
See Also:
start_timer